package com.defines.ming.demo.service.impl;

import com.defines.ming.demo.dao.UserDao;
import com.defines.ming.demo.model.EmpProjectList;
import com.defines.ming.demo.model.User;
import com.defines.ming.demo.service.UserMsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class UserMsgServiceImpl implements UserMsgService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> getlist() {
        List<User> userList = userDao.getUserList();
        return userList ;

    }

    @Override
    public List<User> getListByEmpId(String lastName,String salary) {
        List<User> userList = userDao.getUserFromEmpId(lastName, salary);
        System.out.println("lastName:"+lastName);
        System.out.println("firstName:"+salary);
        System.out.println("minguserList:"+userList.toString());
        return userList;
    }

    @Override
    public void insertUser(User user) {
        System.out.println(user.toString());
        userDao.insertUser(user);
    }

    @Override
    public List<EmpProjectList> getEmpProjectList(String employeeCode) {
        List<EmpProjectList> projectList=userDao.getEmpProjectList(employeeCode);
        System.out.println("employeeCode:"+employeeCode);
        return  projectList;
    }
}
